/*
 * Copyright (C) Michael Opitz
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
 * USA
 */
#ifndef HANDLER_FACTORY
#define HANDLER_FACTORY

#include "../network/connection_manager.h"
#include "../network/network.h"
#include "../network/generic_queue.h"
#include "multicaster.h"

#include <exception>
#include <boost/shared_ptr.hpp>
using namespace std;

/** 
 * \brief This namespace includes all general purpose handler-functions
 * \author Michael Opitz
 */
namespace handler {
	/** 
	 * This factory creates the connection_manager and the multicaster for
	 * the iRoom.
	 * \brief This class creates the initial system
	 * \author Michael Opitz
	 */
	class handler_factory {
	public:
		handler_factory() {};
		virtual ~handler_factory();

		/** 
		 * This method initializes the factory. You should call this
		 * method before you actually call the get-methods.
		 * \brief build builds new objects of the connection_manager,
		 * and the multicaster.
		 */
		virtual void build();
		virtual boost::shared_ptr<network::connection_manager> 
				get_connection_manager();
		virtual boost::shared_ptr<handler::multicaster> 
				get_multicaster();
	private:
		boost::shared_ptr<network::connection_manager> _con_mgr;
		boost::shared_ptr<handler::multicaster> _multi;
	};
}

#endif
